#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../defines.h"

static HOOK_FILE test_hook;

int main(int argc, char* argv[])
{
	char global_pathname[1024];

	memset(global_pathname, 0, sizeof(global_pathname));
	strcpy(global_pathname, argv[1]);
	printf ("global_pathname:%s\n",global_pathname);

	dopath(global_pathname, test_hook);

	return 0;
}

static int test_hook (char* pathname, const struct stat *statptr, int type)
{
	switch(type)
	{
		case FTW_F:
			printf ("this is a file:%s\n", pathname);
/*
			switch (statptr->st_mode & S_IFMT)
			{

			}
*/
			break;
		case FTW_D:
			printf ("directory: %s\n", pathname);
			break;
		case FTW_DNR:
			printf ("can't read directory %s\n", pathname);
			break;
		case FTW_NS:
			printf ("stat error for %s", pathname);
			break;
		default:
		printf ("unknown type %d for pathname %s\n", type, pathname);
	}

	return 0;
}


